/**
 * 详情对话框
 */
var SysSellInfoDlg = {
    data: {
        buyerUserid: "",
        sellerUserid: "",
        ordinal: "",
        price: "",
        contractType: "",
        payType: "",
        stuats: "",
        createTime: "",
        updateTime: "",
        appealTime: "",
        standby1: "",
        standby2: "",
        standby3: "",
        version: ""
    }
};

layui.use(['form', 'admin', "table",'ax'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var table = layui.table;
    var admin = layui.admin;

    //获取详情信息，填充表单
    var ajax = new $ax(Feng.ctxPath + "/sysSell/detail?id=" + Feng.getUrlParam("id"));
    var result = ajax.start();
    result.data.price=result.data.price/100;
    form.val('sysSellForm', result.data);
    layui.$('input').attr('disabled',true);
    layui.$('select').attr('disabled',true);
    layui.form.render();


    if (result.data.sellDetails!=""){
        var sellDetails=JSON.parse(result.data.sellDetails) ;
        for( var i = 0; i < sellDetails.length; i++ ) {
            //动态创建一个tr行标签,并且转换成jQuery对象
            var $trTemp = $("<tr></tr>");
            //往行里面追加 td单元格
            console.log("########q3")
            if (sellDetails[i].payid==3){
                $trTemp.append("<td style='text-align: center'>"+ sellDetails[i].pic +"</td>");
            }else {
                $trTemp.append("<td style='display: flex;justify-content: center'>"+"<img width='50', height='50', src='"+sellDetails[i].pic  +"'>"+"</td>");
            }
            $trTemp.append("<td style='text-align: center'>"+ sellDetails[i].account +"</td>");
            $trTemp.append("<td style='text-align: center'>"+ sellDetails[i].phone +"</td>");
            $trTemp.append("<td style='text-align: center'>"+ sellDetails[i].name +"</td>");
            $trTemp.appendTo("#sellDetails");
        }
    }


    var payDetails=result.data.payDetails;
    if (payDetails!=""){
        var split = payDetails.split(",");
        var $trTemp = $("<tr style='display: flex'></tr>");
        for( var i = 0; i < split.length; i++ ) {
            //动态创建一个tr行标签,并且转换成jQuery对象
            //往行里面追加 th单元格
            $trTemp.append("<th width='130', style='display: flex;justify-content: center'>"+"<img width='50', height='50', class='img_big' src='"+split[i] +"'>"+"</th>");
        }
        $trTemp.appendTo("#payDetails");
    }

    var complainDetails=result.data.complainDetails;
    if (complainDetails!=""){
        var split = complainDetails.split(",");
        var $trTemp = $("<tr style='display: flex'></tr>");
        for( var i = 0; i < split.length; i++ ) {
            //动态创建一个tr行标签,并且转换成jQuery对象
            //往行里面追加 th单元格
            $trTemp.append("<th width='130', style='display: flex;justify-content: center'>"+"<img width='50', height='50',class='img_big', src='"+split[i] +"'>"+"</th>");
        }
        $trTemp.appendTo("#complainDetails");
    }
    $(".img_big").click(function(){
        var url = $(this).attr('src');

        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            area: ['auto'],
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content: '<img style="display: inline-block; width: 700px; height: 700px;" src="' + url + '">'
        });
    })

});